package com.xinzhi.controller;

import com.xinzhi.entity.Result;
import com.xinzhi.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/user")
public class UserInfoController {
    @Autowired
    IUserInfoService iuserInfoService;

    @RequestMapping("/getinfo")
    @ResponseBody
    public Result getUserInfo(Integer loginId,HttpServletRequest request){
        return iuserInfoService.getInfo(loginId,request);
    }
    @RequestMapping("/uptname")
    @ResponseBody
    public Result uptname(Integer loginId,String tname, HttpServletRequest request){
        return iuserInfoService.uptname(tname, loginId, request);
    }
//    @RequestMapping(value = "/upheadhost",method = RequestMethod.POST)
//    @ResponseBody
//    public Result uptheadhost(String headhost, int id, HttpServletRequest request){
//        return iuserInfoService.upheadhost(headhost, id, request);
//    }
    @RequestMapping("/inMan")
    @ResponseBody
    public Result inMan(Integer loginId,String name,String phone){
        return iuserInfoService.inMan(loginId, name,phone);
    }
    @RequestMapping("/getMan")
    @ResponseBody
    public Result getMan(Integer loginId){
        //查询该用户id所有的自提人信息
        return iuserInfoService.getMan(loginId);
    }
    @RequestMapping("/deMan")
    @ResponseBody
    public Result deMan(Integer loginId){
        //拿到这条信息的id用来删除此条信息
        return iuserInfoService.deMan(loginId);
    }
    @RequestMapping("/upMan")
    @ResponseBody
    public Result upMan(Integer loginId,String name,String phone){
        //拿到前端给的id、name、phone来修改信息
        return iuserInfoService.upMan(loginId,name,phone);
    }
}
